package company.wangyi;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * 第三题
 *
 * @author briarbear
 * @blog http://briarbear.github.io
 * @create 2018-09-08-16:09
 */
public class W13 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();  //投票者的个数
            int m = scanner.nextInt();  //候选人的个数
            ArrayList list = new ArrayList<Voter>();
            for (int i = 0; i < n; i++) {
                list.add(new Voter(scanner.nextInt(),scanner.nextInt()));
            }

            Collections.sort(list);


        }
    }
}



class Voter implements  Comparable<Voter>{
    int to;
    int value;

    public Voter(int to, int value) {
        this.to = to;
        this.value = value;
    }

    @Override
    public int compareTo(Voter o) {
        return this.value - o.value;
    }
}
